<%@page import="forms.*, java.util.*" %>

<%@ taglib prefix="bean" uri="http://struts.apache.org/tags-bean" %>
<%@ taglib prefix="logic" uri="http://struts.apache.org/tags-logic" %>
<%@ taglib prefix="html" uri="http://struts.apache.org/tags-html" %>
<%@ page import="javax.sql.*"%>

<%@ page isELIgnored ="false" %> 

<html:html>

<font size="6">Provide degrees - Choose location</font>
<p>


<body>
	<ul style="list-style:none; margin: 0px;"> 
        <li><b>First Name: </b>${applicantDataBean.firstname} </li> 
        <li><b>Middle Name: </b>${applicantDataBean.middlename} </li>
        <li><b>Last Name: </b>${applicantDataBean.lastname} </li>
    </ul> <br>
    
    <b>Country of citizenship: </b>${applicantDataBean.country1} <br>
    <b>Country of residence: </b>${applicantDataBean.country2}
    
    <p>
    <b>Address: </b>${applicantDataBean.address} <br>
    <b>City: </b>${applicantDataBean.city} <br>
    
    
       	
    
    
    <%
    // if "state" is NOT null, means they came from addressPage directly, means they ARE a US citizen
    if (request.getSession().getAttribute("state") != null)  {
    	out.println ("<b>State: </b>" + request.getSession().getAttribute("state"));
    }
    // else means they came from residencyPage, means they ARE NOT a US citizen
    else  {
    	out.println ("<b>Country Code: </b>" + request.getSession().getAttribute("countrycode"));
    }
    %>
    
    <br>
    <b>Zip Code: </b>${applicantDataBean.zipcode} <br>
    <b>Area Code: </b>${applicantDataBean.areacode} <br>
    <b>Telephone Number: </b>${applicantDataBean.telephonenumber}
    
    
    
    <p>
    Current counter: <%= request.getSession().getAttribute("SessionCounter") %>
    <br>
    
    
    <%
	// if not the first time visiting, print out FIRST DEGREE's information
	if (!request.getSession().getAttribute("SessionCounter").equals(0))  {
		List<Degree> theDegreeArray = (LinkedList<Degree>) request.getSession().getAttribute("TheSessionDegreeArray");
		
		for (int i = 0; i < (Integer)(request.getSession().getAttribute("SessionCounter")); i++)  {
			
			Degree currentDegree = theDegreeArray.get(i);
			String currentLocationName = currentDegree.getLocation();
			String currentUniversityName = currentDegree.getUniversity();
			String currentMajorName = currentDegree.getMajor();
			String currentDegreeTitle = currentDegree.getDegreeTitle();
			String currentMonth = currentDegree.getMonth();
			String currentYear = currentDegree.getYear();
			String currentGPA = currentDegree.getGPA();
			String currentTranscriptFile = currentDegree.getMyFile().getFileName();
			out.println ("<br>" + "<b>Location of university: </b>" + currentLocationName + "<br>");
			out.println ("<b>Name of university: </b>" + currentUniversityName + "<br>");
			out.println ("<b>Major: </b>" + currentMajorName + "<br>");
			out.println ("<b>Degree title: </b>" + currentDegreeTitle + "<br>");
			out.println ("<b>Month: </b>" + currentMonth + "<br>");
			out.println ("<b>Year: </b>" + currentYear + "<br>");
			out.println ("<b>GPA: </b>" + currentGPA + "<br>");
			out.println ("<b>Transcript file: </b>" + currentTranscriptFile + "<br>");
		}
	}
	else
	{
	}
    %>
    

    
    
    
   
    
    
    
    <p>
   	Please provide your degree location information.
   	<p>
	
	
	<%
   	RowSet crsLocations = (RowSet) request.getAttribute("crsLocations");
	%>
	
	
	<table cellpadding=0 cellspacing=0 border=0><tr>
	<td width=40% valign=top>
			
	<% 
	// Iterate over the RowSet
			for (int i=0; i<46; i++){
				//each entry in the universities vector is a tuple with the first entry being the country/state
				//and the second entry being a vector of the universities as String's
						
				
				crsLocations.next();%>
					<html:link action="/showDegreeUniversityPage">
	 		     	<html:param name="locationName" value="<%= crsLocations.getString(\"location_name\")%>"/> 
	 		     			<%= crsLocations.getString("location_name")%> </html:link><br>
	 		<%	
			}
			%>
			</td>
			
			<td width=40% valign=top>
			<% 
			for (int i=46; i<93; i++){ %>
				<html:link action="/showDegreeUniversityPage">
	     			<html:param name="locationName" value="<%= crsLocations.getString(\"location_name\")%>"/> 
	     			<%= crsLocations.getString("location_name")%>
	     		</html:link><br><%
				crsLocations.next();
			} %>
			
			<td width=40% valign=top>
			<%
			for (int i=93; i<=138; i++){ %>
				<html:link action="/showDegreeUniversityPage">
	     			<html:param name="locationName" value="<%= crsLocations.getString(\"location_name\")%>"/> 
	     			<%= crsLocations.getString("location_name")%>
	     		</html:link><br><%
				crsLocations.next();
			} 
	%>
	</td>
	</tr>
	</table>


	

	
	
	

</body>
</html:html>